package com.zsxb.crm.result;


import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * 封装分页查询结果
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class PageResult extends Result implements Serializable {

    private long total; //总记录数

    private List rows; //当前页数据集合

    private String params;


    public static PageResult success(PageResult pageResult) {
        PageResult result = new PageResult();
        result.setCode(200);
        result.total = pageResult.getTotal();
        result.rows = pageResult.getRows();
        result.setMsg("查询成功");
        return result;
    }


}
